/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-04-04     donghaomin       the first version
 */
#ifndef APPLICATIONS_USR_DATA_H_
#define APPLICATIONS_USR_DATA_H_

#include <rtthread.h>
#include <string.h>

#define DATA_SUM (unsigned char)0x28       // 存储数据的条数,目前存储40条

#define InitValue (unsigned char)0x00      // 初始化数据的初值
#define SetValue  (unsigned char)0x01      // 初始化数据的初值为1

#define Dong_FALSE (unsigned char)0x00     // bool值的false
#define Dong_TURE  (unsigned char)0x01     // bool值的true

typedef enum UsrState {
    DATA_UN_USED_Sta = 0x00,               // 温度值不正确(不存在)
    DATA_USED_Sta    = 0x01,               // 温度值正确(存在)
    DATA_SUM_Sta
}usrsta;

typedef struct D_USR_DATA{
    unsigned char id;                      // 计数标签
    float value;                           // 温度值
    usrsta state;                          // 状态值，温度值是否正确
}d_data;

typedef struct Dong_BLUE_TEMP{
    unsigned int  blueTooth_state;         // 蓝牙启动的状态位
    unsigned int  blueTooth_connect_state; // 蓝牙连接的状态位，是否断了连接
    unsigned char usedDataCount;           // 当前存储了多少个温度数据
    d_data data[DATA_SUM];                 // 温度数据
}d_bule_temp;

// 温度的数据
d_bule_temp PersonData;

extern int dataInit(void);                 // 数据初始函数
extern d_bule_temp * getTempHandle(void);
#endif /* APPLICATIONS_USR_DATA_H_ */
